<?php
// TODO 默认页面逻辑部分
class SystemAction extends Action {
    public function index(){
        header("Content-Type:text/html; charset=utf-8");
        echo '<div style="font-weight:normal;color:blue;float:left;width:345px;text-align:center;border:1px solid silver;background:#E8EFFF;padding:8px;font-size:14px;font-family:Tahoma">^_^ Hello,欢迎使用<span style="font-weight:bold;color:red">ThinkPHP</span></div>';
    }
    public function md5(){

    }
    public function getstamp(){
		if(!isset($_SESSION['stamp'])){
    	$returnArray = array();
		$_SESSION['stamp'] = substr(md5(mt_rand(10000,99999)),16,6);
		}
    	$returnArray['stamp'] = $_SESSION['stamp'];
    	$this->aReturn($returnArray);
    }
    public function createstamp(){
		if(!isset($_SESSION['stamp'])){
    	$returnArray = array();
		$_SESSION['stamp'] = substr(md5(mt_rand(10000,99999)),16,6);
		}
    }
    public function login(){
		$POST = array();
		$POST = getjson();
		$username = trim($POST['username']);
		$password = trim($POST['password']);
		$password = trim($POST['stamp']);
		if(!(is_null($username)||is_null($password))){
			$this->ajaxReturn(null,false,'登录失败',2);
			exit;
		}
		if(!isset($_SESSION['stamp'])){
			$this->createstamp();
			$this->ajaxReturn(array('stamp'=>$_SESSION['stamp']),false,'登录会话戳失效',3);
			exit;
		}


		echo $username.":".$password;
    }
}